<template>
    <div class="double-integral">
        <div class="integral-container">
            <div class="double-hot-sale">
                <div class="double-goods-detail" v-for='(item,index) in content' :key="index">
                    <div class="double-detail-head">
                        <img :src="item['image_url']" alt="">
                        <div class="sale-message">
                            <div class="sales-num">
                                <span>销量{{item.sales_volume}}</span>
                            </div>
                            <div class="sale-rate">
                                <span>{{item.goods[0]['discount']}}折</span>
                            </div>
                        </div>
                    </div>
                    <div class="double-detail-name">
                        <span>{{item.name}}</span>
                    </div>
                    <div class="double-detail-price">
                        <p>{{item.integral}}积分</p>
                        <div class="integral-btn" @click="toProductDetail(item.id)">
                            <span>立即兑换</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name:'doubleGoods',
    props:['content'],
    methods:{
        toProductDetail(id, status, stock){
            this.$router.push({path:'/product', query:{id:id}});
        }
    },
    mounted(){
        this.transferUrl(this.content);
    }
}
</script>

<style lang='less'>
@rem:100rem;

.double-integral{
    width: 100%;
    .integral-container{
        width: 100%;
        .double-hot-sale{
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            .double-goods-detail{
                width: 345/@rem;
                height: 498/@rem;
                margin: 8/@rem 15/@rem;
                box-shadow: 0 2/@rem 6/@rem rgba(0, 0, 0, 0.2);
                .double-detail-head{
                    position: relative;
                    img{
                        width: 345/@rem;
                        height: 345/@rem;
                    }
                    .sale-message{
                        width: 100%;
                        height: 100%;
                        position: absolute;
                        left: 0;
                        top: 0;
                        display: flex;
                        justify-content: flex-end;
                        align-items: flex-end;
                        .sales-num{
                            height: 44/@rem;
                            padding: 0 12/@rem;
                            display: flex;
                            align-items: center;
                            background: rgba(0, 0, 0, 0.6);
                            span{
                                font-size: 24/@rem;
                                color: #fff;
                            }
                        }
                        .sale-rate{
                            height: 44/@rem;
                            padding: 0 12/@rem;
                            display: flex;
                            align-items: center;
                            background: rgba(209,0,22,0.8);
                            span{
                               font-size: 24/@rem;
                               color: #fff; 
                            }
                        }
                    }
                }
                .double-detail-name{
                    width: 100%;
                    padding: 0 8/@rem;
                    box-sizing: border-box;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;
                    text-align: start;
                    margin-top: 12/@rem;
                }
                .double-detail-price{
                    display: flex;
                    margin-top: 12/@rem;
                    padding: 0 8/@rem;
                    justify-content: space-between;
                    align-items: center;
                    p{
                       font-size: 24/@rem;
                       color: #ff2b48;
                    }
                    .integral-btn{
                        width: 150/@rem;
                        height: 40/@rem;
                        background-color: #6699ff;
                        border-radius: 10/@rem;
                        line-height: 40/@rem;
                        text-align: center;
                        span{
                            font-size: 16/@rem;
                            color: #fff;
                        }
                    }
                    .integral-btn:active{
                        background: #3174fb;
                    }
                }
            }
        }
    }
}
</style>
